import 'package:black_movice/config/configs.dart';
import 'package:black_movice/models/localModels/MenuModel.dart';
import 'package:black_movice/routers.dart';
import 'package:black_movice/utils/Utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

class UserMenuList extends StatefulWidget {
  const UserMenuList({super.key});

  @override
  State<UserMenuList> createState() => _UserMenuListState();
}

// 个人中心一级页面，系统菜单
class _UserMenuListState extends State<UserMenuList> {
  final List<MenuModel> menuList = [
    MenuModel(
        id: 0,
        path: Routers.moviceHistory,
        menuName: "观看历史",
        icon: Icons.query_builder),
    MenuModel(
        id: 1,
        path: Routers.root,
        menuName: "我的收藏",
        icon: Icons.favorite_border_outlined),
    MenuModel(
        id: 2, path: Routers.root, menuName: "我的下载", icon: Icons.download),
    MenuModel(
        id: 3,
        path: Routers.root,
        menuName: "上传视频",
        icon: Icons.upload_outlined),
    MenuModel(
        id: 4, path: Routers.root, menuName: "意见反馈", icon: Icons.help_outline),
    MenuModel(
        id: 5,
        path: Routers.root,
        menuName: "设置",
        icon: Icons.settings_outlined),
  ];
  @override
  Widget build(BuildContext context) {
    return ListView.builder(
        padding: EdgeInsets.all(0),
        itemCount: menuList.length,
        itemBuilder: (context, i) {
          final menu = menuList[i];
          return ListTile(
            dense: true,
            // visualDensity: VisualDensity.compact,
            minVerticalPadding: 0,
            contentPadding: EdgeInsets.symmetric(vertical: 0, horizontal: 10.w),
            leading: Icon(
              menu.icon,
              color: Colors.lightBlueAccent,
            ),
            title: Text(
              menu.menuName,
              style: TextStyle(
                  fontSize: Configs.lgTitleSize_16,
                  fontWeight: FontWeight.normal),
            ),
            trailing: Icon(
              Icons.arrow_forward_ios,
              size: Configs.titleSize_14,
            ),
            onTap: () {
              Utils.logDebug("跳转页面${menu.path}");
              Get.toNamed(menu.path);
            },
          );
        });
  }
}
